Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image buffers #757

Merged
merged 6 commits into from
Dec 17, 2019
Merged

Image buffers #757

merged 6 commits into from
Dec 17, 2019

Conversation

alan-baker
Copy link
Collaborator

Contributes to #747

Add support for specifying buffers as images via a new command.

  • takes dimensionality and dimensions

Generalize image support to support 1D and 3D images.

Add some examples of the new functionality.

* rename layout to dimensionality in parser
* fix up some image copies
* simplify image layouts to use general more often
@alan-baker alan-baker requested a review from dj2 December 16, 2019 21:13
@alan-baker alan-baker self-assigned this Dec 16, 2019
@@ -137,18 +137,38 @@ END
BUFFER {name} DATA_TYPE {type} {STD140 | STD430} SIZE _size_in_items_ \
{initializer}

# Defines a buffer with width and height and filled by data as specified by the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this, I think we should leave this here and just add a # Deprecated use IMAGE tag


```groovy
# Specify an image buffer with a format. HEIGHT is necessary for DIM_2D and
DIM_3D. DEPTH is necessary for DIM_3D.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add # at start of line

{initializer}

# Specify an image buffer with a data type. HEIGHT is necessary for DIM_2D and
DIM_3D. DEPTH is necessary for DIM_3D.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto


# Specify an image buffer with a data type. HEIGHT is necessary for DIM_2D and
DIM_3D. DEPTH is necessary for DIM_3D.
IMAGE {name} DATA_TYPE {type} {dimensionality} \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this accept MIP_LEVELS?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not currently.

if (!token->IsString())
return Result("invalid IMAGE command provided");

std::unique_ptr<Buffer> buffer;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could probably just do:

auto buffer = MakeUnique<Buffer>();

we'd waste the allocation in case of error, but otherwise we always make the buffer this way.


fmt = MakeUnique<Format>(new_type.get());
buffer->SetFormat(fmt.get());
type = new_type.get();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never used?

} else {
return Result("unknown IMAGE command provided: " + cmd);
}
buffer->SetName(name);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could then move up with the buffer creation

@alan-baker alan-baker merged commit 5ea7f38 into google:master Dec 17, 2019
@alan-baker alan-baker deleted the image-buffers branch December 17, 2019 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants