Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1505343003: Updating texture validation to account for sampler objects in ES3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/sampler_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 515a825aaedef5a4becfea456eb0212b8aa51679..7a1d6f709fd3a65057d3acb30d3148f47d37c8b4 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1878,6 +1878,8 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
GLint location,
const std::string& name);
+ const SamplerState& GetSamplerStateForTextureUnit(GLenum target, GLuint unit);
+
// Generate a member function prototype for each command in an automated and
// typesafe way.
#define GLES2_CMD_OP(name) \
@@ -2078,6 +2080,8 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
GLfloat line_width_range_[2];
+ SamplerState default_sampler_state_;
+
DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl);
};
@@ -7590,8 +7594,7 @@ void GLES2DecoderImpl::DoCopyTexImageIfNeeded(Texture* texture,
bool GLES2DecoderImpl::PrepareTexturesForRender() {
DCHECK(state_.current_program.get());
- if (!texture_manager()->HaveUnrenderableTextures() &&
- !texture_manager()->HaveImages()) {
+ if (!texture_manager()->HaveImages()) {
piman 2016/01/20 01:14:02 Hmm, actually, don't you need to go through the co
bajones 2016/01/20 23:57:55 Good catch, I had read the original code as an ||
return true;
}
bool textures_set = false;
@@ -7608,7 +7611,11 @@ bool GLES2DecoderImpl::PrepareTexturesForRender() {
TextureRef* texture_ref =
texture_unit.GetInfoForSamplerType(uniform_info->type).get();
GLenum textarget = GetBindTargetForSamplerType(uniform_info->type);
- if (!texture_ref || !texture_manager()->CanRender(texture_ref)) {
+ const SamplerState& sampler_state = GetSamplerStateForTextureUnit(
+ uniform_info->type, texture_unit_index);
+ if (!texture_ref ||
+ !texture_manager()->CanRenderWithSampler(
+ texture_ref, sampler_state)) {
textures_set = true;
glActiveTexture(GL_TEXTURE0 + texture_unit_index);
glBindTexture(
@@ -7664,7 +7671,11 @@ void GLES2DecoderImpl::RestoreStateForTextures() {
TextureUnit& texture_unit = state_.texture_units[texture_unit_index];
TextureRef* texture_ref =
texture_unit.GetInfoForSamplerType(uniform_info->type).get();
- if (!texture_ref || !texture_manager()->CanRender(texture_ref)) {
+ const SamplerState& sampler_state = GetSamplerStateForTextureUnit(
+ uniform_info->type, texture_unit_index);
+ if (!texture_ref ||
+ !texture_manager()->CanRenderWithSampler(
+ texture_ref, sampler_state)) {
glActiveTexture(GL_TEXTURE0 + texture_unit_index);
// Get the texture_ref info that was previously bound here.
texture_ref =
@@ -15450,6 +15461,21 @@ void GLES2DecoderImpl::DoBindFragmentInputLocationCHROMIUM(
program->SetFragmentInputLocationBinding(name, location);
}
+const SamplerState& GLES2DecoderImpl::GetSamplerStateForTextureUnit(
+ GLenum target, GLuint unit) {
+ if (features().enable_samplers) {
+ Sampler* sampler = state_.sampler_units[unit].get();
+ if (sampler)
+ return sampler->sampler_state();
+ }
+ TextureUnit& texture_unit = state_.texture_units[unit];
+ TextureRef* texture_ref = texture_unit.GetInfoForSamplerType(target).get();
+ if (texture_ref)
+ return texture_ref->texture()->sampler_state();
+
+ return default_sampler_state_;
+}
+
error::Error GLES2DecoderImpl::HandleBindFragmentInputLocationCHROMIUMBucket(
uint32_t immediate_data_size,
const void* cmd_data) {
« no previous file with comments | « no previous file | gpu/command_buffer/service/sampler_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698